using CGF;
using UnityEngine;
using UnityEngine.UI;
public class FlashLight : MonoBehaviour
{
    private Image light;
    private float lightTimer;
    private Color green = ColorHelper.Color("#00E01B");
    private Color yellow = ColorHelper.Color("#FFEB00");

    private void Awake()
    {
        light = GetComponent<Image>();
        lightTimer = Time.time + Random.Range(0f, 1f);
    }

    public void SetColor(bool isPreparing)
    {
        light.color = isPreparing ? yellow : green;
    }

    void Update()
    {
        if (lightTimer < Time.time)
        {
            lightTimer = Time.time + 0.5f;
            light.enabled = !light.enabled;
        }
    }
}
